package com.jof.framework.hmc.sender.email;

import java.util.Date;

import com.jof.framework.hmc.domain.Email;
import com.jof.framework.hmc.sender.SendMsgService;
import com.jof.framework.util.HOPConstant;

public class SendEmailService extends SendMsgService{

	private EmailVerifyStrategy emailVerifyStrategy;
	
	public void sendEmail(final Email email){
		if (emailVerifyStrategy.verifyEmail(email)) {
			email.setSystem(HOPConstant.getAppName());
			email.setSendMessageTime(new Date());
			this.sendMsg(email);
		} else {
			throw new RuntimeException("Email recipient or attachment error!");
		}
	}

	public void setEmailVerifyStrategy(EmailVerifyStrategy emailVerifyStrategy) {
		this.emailVerifyStrategy = emailVerifyStrategy;
	}

}
